<?php

function concatenar($string){

	$string = str_replace("ç","c",$string);

	$string = str_replace("á","a",$string);

	$string = str_replace("à","a",$string);

	$string = str_replace("ã","a",$string);

	$string = str_replace("â","a",$string);

	$string = str_replace("0","0",$string);

	$string = str_replace("é","e",$string);

	$string = str_replace("ê","e",$string);

	$string = str_replace("í","i",$string);

	$string = str_replace("ì","i",$string);

	$string = str_replace("ó","o",$string);

	$string = str_replace("ò","o",$string);

	$string = str_replace("ô","o",$string);

	$string = str_replace("õ","o",$string);

	$string = str_replace("ú","u",$string);

	$string = str_replace("ù","u",$string);

	$string = str_replace("û","u",$string);

	$string = str_replace("-","_",$string);

	$string = str_replace(" ","",$string);

	$string = str_replace(";","_",$string);

	$string = str_replace("(","_",$string);

	$string = str_replace(")","_",$string);

	$string = str_replace("{","_",$string);

	$string = str_replace("}","_",$string);

	$string = str_replace("%","_",$string);

	$string = str_replace("#","_",$string);

    $string = str_replace("::","_",$string);

    $string = str_replace(":","_",$string);

	$string = strtolower($string);

	$string = trim($string);

	return $string;

}

function pag($aux_pag){

	if ($aux_pag == "") {

		$pagina = $_SERVER['SCRIPT_FILENAME'];

	} else {

		$pagina = $aux_pag;

	}

	$len = strlen($pagina);

	$pos = strrpos($pagina, "pag");

	$pagina = substr($pagina , ++$pos,$len);

	

	$pos = strrpos($pagina, ".");

	$pagina = substr($pagina ,0,$pos);

	

	if (strpos($pagina, "_")) {
		$pos = strpos($pagina, "_");

		$pagina = substr($pagina , 0, $pos);
	}
	return $pagina;
}





function valida($string) {

	$string = mysql_real_escape_string($string);
	return $string;

}


function arquivo($string){
	$string = str_replace("arquivo/","",$string);
	return $string;
}


function ida($string){
    
    $string = str_replace("'", " alx ", $string);
    $string = str_replace("%", " cnh ", $string);
    return $string;
}

function retorno($string){
    
    $string = str_replace(" alx ", "'", $string);
    $string = str_replace(" cnh ", "%", $string);
    return $string;
}
?>